#include<iostream>
using namespace std;

//验证：虚表到底在代码段还是数据段
struct A
{ 
public:
  virtual void func()
  {}
private:
  int _a;
};
int g_val = 1;
int g_val_none;
int main(int argc,char* argv[],char* env[])
{
  int a = 0;
  int b = 0;
  static int st = 0;
  int* p = new int(10);
  const char* str = "hello";
  cout <<"命令行参数:" << &argv[0] << endl;
  cout <<"环境变量 "<< &env[0] <<endl;
  cout <<"stack address: a " << &a  << endl;
  cout <<"stack address: b " << &b  << endl;
  cout <<"heap address: p" << p << endl;
  cout <<"Uninit data:g_val_none:" << &g_val_none << endl;
  cout <<"init data:g_val:" << &g_val << endl;
  //cout <<"code segment:main" << main << endl;
  //cout <<"code segment:str" << str << endl;
  printf("code segment main:%p\n",main);
  printf("code segment str:%p\n",str);
  cout <<"-----------------" << endl;
  A aa;
  cout << "虚表的地址:" << *(void**)&aa << endl;
  cout <<"-----------------" << endl;
  return 0;
}
